﻿using System.Windows;

namespace Wp7Tools.ViewServices {
    public class DialogService : IDialogService {

        private static IDialogService _defaultInstance;
        public static IDialogService Default {
            get {
            	if(_defaultInstance == null) {
					_defaultInstance = new DialogService();
            	}
				return _defaultInstance;
            }
            set { _defaultInstance = value; }
        }

        public void ShowMessage(string message) {
			if(Deployment.Current.Dispatcher.CheckAccess()) {
				MessageBox.Show(message);
			}
			else {
				Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(message));				
			}
        }
    }
}